<template>
<table>
    <tr>
        <td>用户名:</td>
        <td>
            <input type="name" v-model="info.Name" placeholder="请输入用户名">
        </td>
    </tr>
    <tr>
        <td>密码:</td>
        <td>
            <input type="password" v-model="info.Password" placeholder="请输入密码">
        </td>
    </tr>
    <tr>
        <td></td>
        <td>
            <input type="button" value="登录" @click="logins" >
        </td>
    </tr>
</table>
</template>

<script setup lang="ts">
import {onMounted, ref} from 'vue'
import axios from 'axios'
import { useRouter } from 'vue-router';


const user=useRouter();

const info=ref({
    "Name": "",
  "Password": ""
})

const logins=()=>{
    axios.get("https://localhost:7285/api/Member/GetMemberLogin",{
        params:{
            username:info.value.Name,
            Password:info.value.Password
        }
    })
    .then(res=>{
        if(res.data.ID==-1){
            alert(res.data.Msg);
        }else if(res.data.ID==-2){
            alert(res.data.Msg)
        }else if(res.data.ID==1){
            alert(res.data.Msg)
            user.push("/AddNumber")
        }
    })
}
</script>

<style scoped>

</style>